﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>HTML辅助方法</title>
</head>
<body>
    <div>
        @Html.Partial("_PartialPage1")
        <h1>前段原生写法</h1>
        <a href="/HTMLHelper/ChuanZhi?name=张三&age=20">向控制器传值</a>
        <a href="https://www.baidu.com">百度一下</a>
        @*<form action="/HTMLHelper/ChuanZhi" method="post">
            <input type="text" name="name" value="" />
            <input type="text" name="age" value="" />
            <input type="submit" value="提交" />
        </form>*@

        <hr />
        <h1>HTML辅助方法</h1>
        @Html.ActionLink("向控制器传值(HTML辅助方法)", "ChuanZhi")
        <br />
        @Html.ActionLink("向控制器传值(HTML辅助方法，带参数)", "ChuanZhi", new { name = "李四", age = 21 })
        <br />
        @Html.ActionLink("向控制器传值(HTML辅助方法，带参数)", "ChuanZhi", new { name = "王五", age = 23 }, new { style = "color:red;" })
        <br />
        @Html.ActionLink("百度一下", null, null, new { href = "https://www.baidu.com" })

        @*@{
            Html.BeginForm("ChuanZhi", "HTMLHelper", FormMethod.Post);
            <input type="text" name="name" value="" />
            <input type="text" name="age" value="" />
            <input type="submit" value="提交" />
            Html.EndForm();
        }*@

        @using (Html.BeginForm("ChuanZhi", "HTMLHelper", FormMethod.Post))
        {
            <input type="text" name="name" value="" />
            <input type="text" name="age" value="" />
            <input type="submit" value="提交" />
        }

        <hr />
        <h1>姓名：@ViewBag.name  年龄：@ViewBag.age</h1>
        @Html.Partial("_PartialPage1")
    </div>
</body>
</html>
